package com.puppet.building.handler.exception;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionController {

    @ExceptionHandler(MyBuildingException.class)
    public ResponseEntity<?> handlerException(MyBuildingException e){
        System.out.println("全局异常拦截到异常信息！");
        return ResponseEntity.status(e.getResult().getCode()).body(e.getResult());

    }}
